#include "SceneSelector.h"
#include "imgui.h"
#include "TestScene.h"
SceneSelector::SceneSelector() {
	mCurrentSample = nullptr;
}

SceneSelector::~SceneSelector() {
	if (mCurrentSample) {
		delete mCurrentSample;
	}
}

SceneBase* SceneSelector::GetCurrentSample() {
	return mCurrentSample;
}

void SceneSelector::Initialize() {

}

void SceneSelector::Update(float inDeltaTime) {
	if (mCurrentSample) {
		mCurrentSample->Update(inDeltaTime);
	}
}
void SceneSelector::Render() {
	if (mCurrentSample) {
		mCurrentSample->Render();
	}
}
void SceneSelector::ImGui() {
	if (mCurrentSample) {
		mCurrentSample->ImGUI();
		ImGui::Separator();
		if (ImGui::Button(u8"Close")) {
			mCurrentSample->ShutDown();
			delete mCurrentSample;
			mCurrentSample = nullptr;
		}
	}
	else {
		if (ImGui::Button(u8"Scene")) {
			mCurrentSample = new TestScene();
			mCurrentSample->Init();
		}
	}
	ImGui::End();
}

void SceneSelector::Shutdown() {
	if (mCurrentSample) {
		mCurrentSample->ShutDown();
	}
}


